import java.util.Date;
import play.test.*;
import org.junit.*;
import models.*;

public class Doaa extends UnitTest {

	@Test
	public void startActionPlanCheck() {

		Fixtures.deleteAll();

		IdeaDeveloper dev = new IdeaDeveloper("Doaa", "Doaa", "Doaa",
				"DoaaRamiz@gmail.com", "14/8/1991", "nasr city");
		dev.save();

		IdeaDeveloper dev2 = new IdeaDeveloper("Doaa", "Doaa", "Doaa",
				"DoaaRamiz@gmail.com", "14/8/1991", "nasr city");
		dev2.save();

		IdeaDeveloper dev3 = new IdeaDeveloper("Doaa", "Doaa", "Doaa",
				"DoaaRamiz@gmail.com", "14/8/1991", "nasr city");
		dev3.save();

		Organizer organizer = Organizer.create(dev);
		organizer.save();

		OrganizationLead lead = OrganizationLead.create(dev2);
		lead.save();

		Organization org = Organization.create(dev2, "new Org", "new org",
				"public");
		org.save();

		Idea idea1 = Idea.create(dev3, org);
		idea1.save();
		idea1.promotedForExecution = true;

		Idea idea2 = Idea.create(dev3, org);
		idea2.save();
		idea2.promotedForExecution = false;

		assertEquals("Action plan started", organizer.startActionPlan(
				"action plan", idea1, "des", new Date(111, 6, 1), new Date(111,
						7, 1)));
		assertEquals("Sorry, this idea is not promoted for execution",
				organizer.startActionPlan("action plan1", idea2, "des",
						new Date(), new Date(111, 7, 1)));
		assertEquals("Sorry this name is not avaliable",
				organizer.startActionPlan("action plan", idea1, "des",
						new Date(), new Date(111, 7, 1)));
		assertEquals("Sorry, stat date can not precede today",
				organizer.startActionPlan("action plan2", idea1, "des",
						new Date(111, 1, 1), new Date(111, 7, 1)));
		assertEquals("Sorry, end date can not precede start date",
				organizer.startActionPlan("action plan3", idea1, "des",
						new Date(111, 7, 1), new Date(111, 5, 1)));

	}

}
